package baseClass;

/*
    语义分析错误基本类
    2022-3-11-杨海南
 */
public class ErrorSema {
    /*
        语义错误可以分为以下几个方面
            符号表中不包含符号
            函数/过程未定义
            参数数量/类型不匹配
            类型不匹配
            period错误

     */
    private int errorIndex;
    private int line;
    private int indexInLine;
    private SemaErrorEnum errorType;
    private String tips;


    public ErrorSema(int line, int indexInLine, SemaErrorEnum errorType, String tips) {
        this.line = line;
        this.indexInLine = indexInLine;
        this.errorType = errorType;
        this.tips = tips;
    }

    public void setErrorIndex(int errorIndex) {
        this.errorIndex = errorIndex;
    }

    public int getErrorIndex() {
        return errorIndex;
    }

    public int getLine() {
        return line;
    }

    public int getIndexInLine() {
        return indexInLine;
    }

    public SemaErrorEnum getErrorType() {
        return errorType;
    }

    @Override
    public String toString() {
        return "ErrorSema{" + line +
                ":" + indexInLine +
                "->errorType=" + errorType +
                "->tips='" + tips + '\'' +
                '}';
    }
}
